using System;
using System.Collections.Generic;
using System.Text;
using CMS.Presenters.Views.ListManager;
using CMS.Core.DataInterfaces;
using System.Collections;
using AjaxPro;
using CMS.Data;

namespace CMS.Presenters.Presenters.ListManager
{
    public class MainScreenPresenter
    {
        private IMainScreenView iObjView;
        private IDonThuDao iObjDAO;

        public MainScreenPresenter() { }
        public MainScreenPresenter(IMainScreenView iObjView, IDonThuDao iObjDAO)
        {
            if (iObjView == null) throw new ArgumentNullException("View may not be null");
            if (iObjDAO == null) throw new ArgumentNullException("LinhVucDao may not be null");
            this.iObjView = iObjView;
            this.iObjDAO = iObjDAO;            

            SubscribeViewToEvents();
        }

        void SubscribeViewToEvents()
        {
            iObjView.Load += OnViewLoad;
        }

        void OnViewLoad(object sender, EventArgs e)
        {
            //LoadViewFromModel();
        }

        [AjaxMethod]
        public IList LoadViewFromModel()
        {
            this.iObjDAO = new DonThuDao();
            return this.iObjDAO.GetSumDonThus();
        }
    }
}
